package com.jt.util;

import com.jt.pojo.User;

/**
 * ThreadLocal工具API
 * @author Administrator
 */
public class UserThreadLocal {
	public static final ThreadLocal<User> thread=new ThreadLocal<>();
	
	public static void set(User user) {//往ThreadLocal中存数据
		thread.set(user);
	}
	
	public static User get() {//从ThreadLocal中取数据
		return thread.get();
	}
	
	public static void remove() {//清楚ThreadLocal中的数据，防止内存泄漏
		thread.remove();
	}
}
